<template>
	<div class="card m5 p10 flex_col">
		<label class="flex_center_self">门控制</label>
		<div class="flex_row mt5">
			<el-button @click="onClickDoor" type="primary">开门</el-button>
			<el-button @click="onClickScan" type="primary">扫码</el-button>
		</div>
	</div>
</template>

<script setup lang="ts">
import service from '../service/service';
import { runAction, runAction2 } from '../utils/ui';


async function onClickDoor() {
	runAction('开门', '开门', async () => {
		await service.doorOpen();
	});
}

async function onClickScan() {
	runAction2('扫码', '', async (dialog) => {
		const barcode = await service.scan();
		dialog.success(`条码:${barcode}`);
	});
}

</script>
